<?php
apf_require_class('DAO_DAO');
class Dao_Attendance_SpecialDay extends DAO {

    public function get_table_name() {
        return "special_day";
    }

    public function get_read_pdo_name() {
        return "attendance_slave";
    }

    public function get_write_pdo_name() {
        return "attendance_master";
    }

    public function get_table_pk() {
        return "id";
    }
    public function get_special_days_list($where,$order="id DESC",$limit = 0,$offset = 0) {
        apf_require_class("Dao_Attendance_UserInfo");
        $dao_userinfo = new Dao_Attendance_UserInfo();
        $s_sql = "select u_r.*,u_i.name from ".$dao_userinfo->get_table_name()." as u_i
                  right join ".$this->get_table_name()." as u_r
                  on u_r.user_id = u_i.user_id order by {$order} limit {$limit} offset {$offset}";
        $data = $this->execute($s_sql);
        $s_sql = "select count(*) as total_rows from ".$this->get_table_name();
        $rows = $this->execute($s_sql);
        return array('data'=>$data,'total'=>$rows[0]['total_rows']);
    }
}